package de.saarland.uni.lego3d.server;

/**
 * This class represents the datagram message, that is send from the kinect client
 * to the server. It just encapsulate all the informations about currents movements and interactions
 */
public class KinectAction {

	/**
	 * Acceleration of movement in forward direction (value between 0 to 100)
	 */
	private int direction_forward = 0;
	
	/**
	 * Acceleration of movement in backward direction (value between 0 to 100)
	 */
	private int direction_backward = 0;
	
	/**
	 * Acceleration of movement in left direction (value between 0 to 100)
	 */
	private int direction_left = 0; 
	
	/**
	 * Acceleration of movement in right direction (value between 0 to 100)
	 */
	private int direction_right = 0;
	
	/**
	 * Acceleration of movement in upwards direction (value between 0 to 100)
	 */
	private int direction_up = 0;
	
	/**
	 * Acceleration of movement in downwards direction (value between 0 to 100)
	 */
	private int direction_down = 0;
	
	/**
	 * Indicator for swipe movement to the left
	 * TODO: Use the gesture somehow in the Application (Rotation?)
	 */
	private boolean swipe_left = false;
	
	/**
	 * Indicator for swipe movement to the right
	 * TODO: Use the gesture somehow in the Application (Rotation?)
	 */
	private boolean swipe_right = false;
	
	/**
	 * Indicator for click action during mousemode.
	 */
	private boolean action_click = false;
	
	/**
	 * Indicating if mousemode is active or not:
	 * true - User is currently controling the system cursor
	 * false - User is either in brickmode or no interaction is active
	 */
	private boolean action_mouse = false;
	
	/**
	 * Indicating if brickmode is active or not:
	 * true - User is currently controling a selected lego brick
	 * false - User is either in mousemode or no interaction is active
	 */
	private boolean action_brick = false;

	
	public KinectAction(int dirF, int dirB, int dirL, int dirR, int dirU, int dirD,
			boolean swipeL, boolean swipeR, boolean actionC, boolean mouse, boolean brick) {
		direction_forward = dirF;
		direction_backward = dirB;
		direction_left = dirL;
		direction_right = dirR;
		direction_up = dirU;
		direction_down = dirD;
		
		swipe_left = swipeL;
		swipe_right = swipeR;
		
		action_click = actionC;
		action_mouse = mouse;
		action_brick = brick;
	}
	
	public int getDirection_forward() {
		return direction_forward;
	}

	public int getDirection_backward() {
		return direction_backward;
	}

	public int getDirection_left() {
		return direction_left;
	}

	public int getDirection_right() {
		return direction_right;
	}

	public int getDirection_up() {
		return direction_up;
	}

	public int getDirection_down() {
		return direction_down;
	}

	public boolean isSwipe_left() {
		return swipe_left;
	}

	public boolean isSwipe_right() {
		return swipe_right;
	}

	public boolean isAction_click() {
		return action_click;
	}
	
	public boolean isAction_mouse() {
		return action_mouse;
	}
	
	public boolean isAction_brick() {
		return action_brick;
	}
	
	/**
	 * Used for debugging
	 * @return
	 */
	@Override
	public String toString() {
		return  "Forward: " + direction_forward +"% - " 
				+ "Backward: " + direction_backward +"% - "
				+ "Left: " + direction_left +"% - "
				+ "Right: " + direction_right +"% - "
				+ "Up: " + direction_up +"% - "
				+ "Down: " + direction_down +"% - "
				+ "Swipe: " + (swipe_left ? "LEFT " : (swipe_right ? "RIGHT " : " ")) + " - "
				+ "Click: " + (action_click ? "YES" : "NO") + " - "
				+ "Mouse: " + (action_mouse ? "YES" : "NO") + " - "
				+ "Brick: " + (action_brick ? "YES" : "NO");
	}
}
